home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v8n05.arc
/
BINARY.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-02-15
|
827b
|
32 lines
PROGRAM Binary;
USES Crt; {<== Comment out this line for TP3}
{ This program displays a binary number from 0 to 7
using the Caps/Num/Scroll Lock LED indicators. }
TYPE LEDnum = 0..7;
VAR B : Byte;
dummy : char;
PROCEDURE BinLed(L : LEDnum);
VAR ShiftByte : byte absolute $0000:$0417;
{ shift status byte }
BEGIN
ShiftByte := L SHL 4;
END;
BEGIN
WriteLn('Press a key to display binary numbers on the LEDs.');
WriteLn('Press another key to stop the display.');
dummy := ReadKey; {<== comment out this line for TP3}
{Read(Kbd,dummy);} {<== UN-comment this line for TP3}
B := 0;
REPEAT
WriteLn('Displaying ',B);
BinLed(B);
Delay(1000);
B := Succ(B) MOD 8;
UNTIL KeyPressed;
BinLed(0); {Turn off shift states!}
END. { PROGRAM Binary }